#include <Arduino.h>
#include <WiFi.h>
#include <WiFiManager.h>

#define LED 2
void setup()
{
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);

  WiFiManager manager;
  // manager.resetSettings(); // 清除之前保存的账号密码，在实际产品中一定要注释掉，不然每次启动都要配网
  manager.autoConnect("auto-connect-esp32");
  while (!WiFi.isConnected())
  {
    Serial.println("等待网络连接...");
    delay(1000);
  }

  digitalWrite(LED, HIGH);
  Serial.print("网络连接成功，IP: ");
  Serial.println(WiFi.localIP());
}

void loop()
{
}
